<template>
	<uv-tabbar :customStyle="{'height':'120rpx'}" :value="tabbarStore.tabIndex" @change="barChange">
		<!-- <uv-tabbar-item text="首页" icon="home"></uv-tabbar-item>
		<uv-tabbar-item text="活动" icon="photo"></uv-tabbar-item>
		<uv-tabbar-item text="消息" icon="chat"></uv-tabbar-item>
		<uv-tabbar-item text="我的" icon="account"></uv-tabbar-item> -->
		<uv-tabbar-item v-for="tab in list" :text="tab.text" :icon="tab.icon"  ></uv-tabbar-item>
	</uv-tabbar>
</template>

<script setup>
	import {
		ref
	} from 'vue'
	import { useTabbarStore } from '@/stores/tabbarer'
	const tabbarStore = useTabbarStore()
	const list = ref([{
		pagePath: "/pages/home/index",
		text: "首页",
		icon: "home"
	}
	// , {
	// 	pagePath: "/pages/home/index",
	// 	text: "活动",
	// 	icon: "photo"
	// }
	, {
		pagePath: "/pages/message/messageList",
		text: "消息",
		icon: "chat"
	}
	, {
		pagePath: "/pages/person/index",
		text: "我的",
		icon: "account"
	}])
	const barChange = (index) => {
		uni.switchTab({
			url:list.value[index].pagePath
		})
		tabbarStore.tabIndex = index
		console.log(index);
	}
</script>

<style>
</style>